<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP          #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE BangPatterns #-}</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__ &gt;= 701
</span><span class="hs-pragma">{-# LANGUAGE Trustworthy #-}</span><span class="hs-cpp">
#endif
</span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- | Copyright : (c) 2010      Jasper Van der Jeugt</span><span>
</span><span id="line-8"></span><span class="hs-comment">--               (c) 2010-2011 Simon Meier</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- License     : BSD3-style (see LICENSE)</span><span>
</span><span id="line-10"></span><span class="hs-comment">--</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- Maintainer  : Simon Meier &lt;iridcode@gmail.com&gt;</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- Portability : GHC</span><span>
</span><span id="line-13"></span><span class="hs-comment">--</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- Extra functions for creating and executing 'Builder's. They are intended</span><span>
</span><span id="line-15"></span><span class="hs-comment">-- for application-specific fine-tuning the performance of 'Builder's.</span><span>
</span><span id="line-16"></span><span class="hs-comment">--</span><span>
</span><span id="line-17"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-18"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Data.ByteString.Builder.Extra</span><span>
</span><span id="line-19"></span><span>    </span><span class="hs-special">(</span><span>
</span><span id="line-20"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Execution strategies</span></span><span>
</span><span id="line-21"></span><span>      </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#toLazyByteStringWith"><span class="hs-identifier">toLazyByteStringWith</span></a></span><span>
</span><span id="line-22"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#AllocationStrategy"><span class="hs-identifier">AllocationStrategy</span></a></span><span>
</span><span id="line-23"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#safeStrategy"><span class="hs-identifier">safeStrategy</span></a></span><span>
</span><span id="line-24"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#untrimmedStrategy"><span class="hs-identifier">untrimmedStrategy</span></a></span><span>
</span><span id="line-25"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#smallChunkSize"><span class="hs-identifier">smallChunkSize</span></a></span><span>
</span><span id="line-26"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#defaultChunkSize"><span class="hs-identifier">defaultChunkSize</span></a></span><span>
</span><span id="line-27"></span><span>
</span><span id="line-28"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Controlling chunk boundaries</span></span><span>
</span><span id="line-29"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#byteStringCopy"><span class="hs-identifier">byteStringCopy</span></a></span><span>
</span><span id="line-30"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#byteStringInsert"><span class="hs-identifier">byteStringInsert</span></a></span><span>
</span><span id="line-31"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#byteStringThreshold"><span class="hs-identifier">byteStringThreshold</span></a></span><span>
</span><span id="line-32"></span><span>
</span><span id="line-33"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#lazyByteStringCopy"><span class="hs-identifier">lazyByteStringCopy</span></a></span><span>
</span><span id="line-34"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#lazyByteStringInsert"><span class="hs-identifier">lazyByteStringInsert</span></a></span><span>
</span><span id="line-35"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#lazyByteStringThreshold"><span class="hs-identifier">lazyByteStringThreshold</span></a></span><span>
</span><span id="line-36"></span><span>
</span><span id="line-37"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#flush"><span class="hs-identifier">flush</span></a></span><span>
</span><span id="line-38"></span><span>
</span><span id="line-39"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Low level execution</span></span><span>
</span><span id="line-40"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#BufferWriter"><span class="hs-identifier">BufferWriter</span></a></span><span>
</span><span id="line-41"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#Next"><span class="hs-identifier">Next</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-42"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#runBuilder"><span class="hs-identifier">runBuilder</span></a></span><span>
</span><span id="line-43"></span><span>
</span><span id="line-44"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Host-specific binary encodings</span></span><span>
</span><span id="line-45"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#intHost"><span class="hs-identifier">intHost</span></a></span><span>
</span><span id="line-46"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#int16Host"><span class="hs-identifier">int16Host</span></a></span><span>
</span><span id="line-47"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#int32Host"><span class="hs-identifier">int32Host</span></a></span><span>
</span><span id="line-48"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#int64Host"><span class="hs-identifier">int64Host</span></a></span><span>
</span><span id="line-49"></span><span>
</span><span id="line-50"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#wordHost"><span class="hs-identifier">wordHost</span></a></span><span>
</span><span id="line-51"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#word16Host"><span class="hs-identifier">word16Host</span></a></span><span>
</span><span id="line-52"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#word32Host"><span class="hs-identifier">word32Host</span></a></span><span>
</span><span id="line-53"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#word64Host"><span class="hs-identifier">word64Host</span></a></span><span>
</span><span id="line-54"></span><span>
</span><span id="line-55"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#floatHost"><span class="hs-identifier">floatHost</span></a></span><span>
</span><span id="line-56"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#doubleHost"><span class="hs-identifier">doubleHost</span></a></span><span>
</span><span id="line-57"></span><span>
</span><span id="line-58"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-59"></span><span>
</span><span id="line-60"></span><span>
</span><span id="line-61"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html"><span class="hs-identifier">Data.ByteString.Builder.Internal</span></a></span><span>
</span><span id="line-62"></span><span>         </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier">Builder</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#toLazyByteStringWith"><span class="hs-identifier">toLazyByteStringWith</span></a></span><span>
</span><span id="line-63"></span><span>         </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#AllocationStrategy"><span class="hs-identifier">AllocationStrategy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#safeStrategy"><span class="hs-identifier">safeStrategy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#untrimmedStrategy"><span class="hs-identifier">untrimmedStrategy</span></a></span><span>
</span><span id="line-64"></span><span>         </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#smallChunkSize"><span class="hs-identifier">smallChunkSize</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#defaultChunkSize"><span class="hs-identifier">defaultChunkSize</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#flush"><span class="hs-identifier">flush</span></a></span><span>
</span><span id="line-65"></span><span>         </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#byteStringCopy"><span class="hs-identifier">byteStringCopy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#byteStringInsert"><span class="hs-identifier">byteStringInsert</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#byteStringThreshold"><span class="hs-identifier">byteStringThreshold</span></a></span><span>
</span><span id="line-66"></span><span>         </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#lazyByteStringCopy"><span class="hs-identifier">lazyByteStringCopy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#lazyByteStringInsert"><span class="hs-identifier">lazyByteStringInsert</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#lazyByteStringThreshold"><span class="hs-identifier">lazyByteStringThreshold</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-67"></span><span>
</span><span id="line-68"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html"><span class="hs-identifier">Data.ByteString.Builder.Internal</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">I</span></span><span>
</span><span id="line-69"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Prim.html"><span class="hs-identifier">Data.ByteString.Builder.Prim</span></a></span><span>  </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">P</span></span><span>
</span><span id="line-70"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html"><span class="hs-identifier">Data.ByteString.Internal</span></a></span><span>      </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">S</span></span><span>
</span><span id="line-71"></span><span>
</span><span id="line-72"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.html#"><span class="hs-identifier">Foreign</span></a></span><span>
</span><span id="line-73"></span><span>
</span><span id="line-74"></span><span class="hs-comment">------------------------------------------------------------------------------</span><span>
</span><span id="line-75"></span><span class="hs-comment">-- Builder execution public API</span><span>
</span><span id="line-76"></span><span class="hs-comment">------------------------------------------------------------------------------</span><span>
</span><span id="line-77"></span><span>
</span><span id="line-78"></span><span class="hs-comment">-- | A 'BufferWriter' represents the result of running a 'Builder'.</span><span>
</span><span id="line-79"></span><span class="hs-comment">-- It unfolds as a sequence of chunks of data. These chunks come in two forms:</span><span>
</span><span id="line-80"></span><span class="hs-comment">--</span><span>
</span><span id="line-81"></span><span class="hs-comment">--  * an IO action for writing the Builder's data into a user-supplied memory</span><span>
</span><span id="line-82"></span><span class="hs-comment">--    buffer.</span><span>
</span><span id="line-83"></span><span class="hs-comment">--</span><span>
</span><span id="line-84"></span><span class="hs-comment">--  * a pre-existing chunks of data represented by a strict 'S.ByteString'</span><span>
</span><span id="line-85"></span><span class="hs-comment">--</span><span>
</span><span id="line-86"></span><span class="hs-comment">-- While this is rather low level, it provides you with full flexibility in</span><span>
</span><span id="line-87"></span><span class="hs-comment">-- how the data is written out.</span><span>
</span><span id="line-88"></span><span class="hs-comment">--</span><span>
</span><span id="line-89"></span><span class="hs-comment">-- The 'BufferWriter' itself is an IO action: you supply it with a buffer</span><span>
</span><span id="line-90"></span><span class="hs-comment">-- (as a pointer and length) and it will write data into the buffer.</span><span>
</span><span id="line-91"></span><span class="hs-comment">-- It returns a number indicating how many bytes were actually written</span><span>
</span><span id="line-92"></span><span class="hs-comment">-- (which can be @0@). It also returns a 'Next' which describes what</span><span>
</span><span id="line-93"></span><span class="hs-comment">-- comes next.</span><span>
</span><span id="line-94"></span><span class="hs-comment">--</span><span>
</span><span id="line-95"></span><span class="hs-keyword">type</span><span> </span><span id="BufferWriter"><span class="annot"><a href="Data.ByteString.Builder.Extra.html#BufferWriter"><span class="hs-identifier hs-var">BufferWriter</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#Next"><span class="hs-identifier hs-type">Next</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-96"></span><span>
</span><span id="line-97"></span><span class="hs-comment">-- | After running a 'BufferWriter' action there are three possibilities for</span><span>
</span><span id="line-98"></span><span class="hs-comment">-- what comes next:</span><span>
</span><span id="line-99"></span><span class="hs-comment">--</span><span>
</span><span id="line-100"></span><span class="hs-keyword">data</span><span> </span><span id="Next"><span class="annot"><a href="Data.ByteString.Builder.Extra.html#Next"><span class="hs-identifier hs-var">Next</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-101"></span><span>     </span><span class="hs-comment">-- | This means we're all done. All the builder data has now been written.</span><span>
</span><span id="line-102"></span><span>     </span><span id="Done"><span class="annot"><a href="Data.ByteString.Builder.Extra.html#Done"><span class="hs-identifier hs-var">Done</span></a></span></span><span>
</span><span id="line-103"></span><span>
</span><span id="line-104"></span><span>     </span><span class="hs-comment">-- | This indicates that there may be more data to write. It</span><span>
</span><span id="line-105"></span><span>     </span><span class="hs-comment">-- gives you the next 'BufferWriter' action. You should call that action</span><span>
</span><span id="line-106"></span><span>     </span><span class="hs-comment">-- with an appropriate buffer. The int indicates the /minimum/ buffer size</span><span>
</span><span id="line-107"></span><span>     </span><span class="hs-comment">-- required by the next 'BufferWriter' action. That is, if you call the next</span><span>
</span><span id="line-108"></span><span>     </span><span class="hs-comment">-- action you /must/ supply it with a buffer length of at least this size.</span><span>
</span><span id="line-109"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span id="More"><span class="annot"><a href="Data.ByteString.Builder.Extra.html#More"><span class="hs-identifier hs-var">More</span></a></span></span><span>   </span><span class="hs-glyph">!</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>          </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#BufferWriter"><span class="hs-identifier hs-type">BufferWriter</span></a></span><span>
</span><span id="line-110"></span><span>
</span><span id="line-111"></span><span>     </span><span class="hs-comment">-- | In addition to the data that has just been written into your buffer</span><span>
</span><span id="line-112"></span><span>     </span><span class="hs-comment">-- by the 'BufferWriter' action, it gives you a pre-existing chunk</span><span>
</span><span id="line-113"></span><span>     </span><span class="hs-comment">-- of data as a 'S.ByteString'. It also gives you the following 'BufferWriter'</span><span>
</span><span id="line-114"></span><span>     </span><span class="hs-comment">-- action. It is safe to run this following action using a buffer with as</span><span>
</span><span id="line-115"></span><span>     </span><span class="hs-comment">-- much free space as was left by the previous run action.</span><span>
</span><span id="line-116"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span id="Chunk"><span class="annot"><a href="Data.ByteString.Builder.Extra.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span></span><span>  </span><span class="hs-glyph">!</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">S.ByteString</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#BufferWriter"><span class="hs-identifier hs-type">BufferWriter</span></a></span><span>
</span><span id="line-117"></span><span>
</span><span id="line-118"></span><span class="hs-comment">-- | Turn a 'Builder' into its initial 'BufferWriter' action.</span><span>
</span><span id="line-119"></span><span class="hs-comment">--</span><span>
</span><span id="line-120"></span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#runBuilder"><span class="hs-identifier hs-type">runBuilder</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#BufferWriter"><span class="hs-identifier hs-type">BufferWriter</span></a></span><span>
</span><span id="line-121"></span><span id="runBuilder"><span class="annot"><span class="annottext">runBuilder :: Builder -&gt; BufferWriter
</span><a href="Data.ByteString.Builder.Extra.html#runBuilder"><span class="hs-identifier hs-var hs-var">runBuilder</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BuildStep () -&gt; BufferWriter
</span><a href="#local-6989586621679078685"><span class="hs-identifier hs-var">run</span></a></span><span> </span><span class="annot"><span class="annottext">(BuildStep () -&gt; BufferWriter)
-&gt; (Builder -&gt; BuildStep ()) -&gt; Builder -&gt; BufferWriter
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Builder -&gt; BuildStep ()
</span><a href="Data.ByteString.Builder.Internal.html#runBuilder"><span class="hs-identifier hs-var">I.runBuilder</span></a></span><span>
</span><span id="line-122"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-123"></span><span>    </span><span id="local-6989586621679078682"><span class="annot"><span class="annottext">bytesWritten :: Ptr b -&gt; Ptr a -&gt; Int
</span><a href="#local-6989586621679078682"><span class="hs-identifier hs-var hs-var">bytesWritten</span></a></span></span><span> </span><span id="local-6989586621679078681"><span class="annot"><span class="annottext">Ptr b
</span><a href="#local-6989586621679078681"><span class="hs-identifier hs-var">startPtr</span></a></span></span><span> </span><span id="local-6989586621679078680"><span class="annot"><span class="annottext">Ptr a
</span><a href="#local-6989586621679078680"><span class="hs-identifier hs-var">endPtr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ptr a
</span><a href="#local-6989586621679078680"><span class="hs-identifier hs-var">endPtr</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr a -&gt; Ptr b -&gt; Int
forall a b. Ptr a -&gt; Ptr b -&gt; Int
</span><a href="../../base/src/GHC.Ptr.html#minusPtr"><span class="hs-operator hs-var">`minusPtr`</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr b
</span><a href="#local-6989586621679078681"><span class="hs-identifier hs-var">startPtr</span></a></span><span>
</span><span id="line-124"></span><span>
</span><span id="line-125"></span><span>    </span><span class="annot"><a href="#local-6989586621679078685"><span class="hs-identifier hs-type">run</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#BuildStep"><span class="hs-identifier hs-type">I.BuildStep</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#BufferWriter"><span class="hs-identifier hs-type">BufferWriter</span></a></span><span>
</span><span id="line-126"></span><span>    </span><span id="local-6989586621679078685"><span class="annot"><span class="annottext">run :: BuildStep () -&gt; BufferWriter
</span><a href="#local-6989586621679078685"><span class="hs-identifier hs-var hs-var">run</span></a></span></span><span> </span><span id="local-6989586621679078678"><span class="annot"><span class="annottext">BuildStep ()
</span><a href="#local-6989586621679078678"><span class="hs-identifier hs-var">step</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679078677"><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679078677"><span class="hs-identifier hs-var">buf</span></a></span></span><span> </span><span id="local-6989586621679078676"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679078676"><span class="hs-identifier hs-var">len</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-127"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679078673"><span class="annot"><span class="annottext">doneH :: Ptr a -&gt; () -&gt; m (Int, Next)
</span><a href="#local-6989586621679078673"><span class="hs-identifier hs-var hs-var">doneH</span></a></span></span><span> </span><span id="local-6989586621679078672"><span class="annot"><span class="annottext">Ptr a
</span><a href="#local-6989586621679078672"><span class="hs-identifier hs-var">endPtr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-128"></span><span>            </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679078671"><span class="annot"><span class="annottext">wc :: Int
</span><a href="#local-6989586621679078671"><span class="hs-identifier hs-var hs-var">wc</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Ptr a -&gt; Int
forall a b. Ptr a -&gt; Ptr b -&gt; Int
</span><a href="#local-6989586621679078682"><span class="hs-identifier hs-var">bytesWritten</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679078677"><span class="hs-identifier hs-var">buf</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr a
</span><a href="#local-6989586621679078672"><span class="hs-identifier hs-var">endPtr</span></a></span><span>
</span><span id="line-129"></span><span>                </span><span id="local-6989586621679078670"><span class="annot"><span class="annottext">next :: Next
</span><a href="#local-6989586621679078670"><span class="hs-identifier hs-var hs-var">next</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Next
</span><a href="Data.ByteString.Builder.Extra.html#Done"><span class="hs-identifier hs-var">Done</span></a></span><span>
</span><span id="line-130"></span><span>             </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">(Int, Next) -&gt; m (Int, Next)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679078671"><span class="hs-identifier hs-var">wc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Next
</span><a href="#local-6989586621679078670"><span class="hs-identifier hs-var">next</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-131"></span><span>
</span><span id="line-132"></span><span>          </span><span id="local-6989586621679078667"><span class="annot"><span class="annottext">bufferFullH :: Ptr a -&gt; Int -&gt; BuildStep () -&gt; m (Int, Next)
</span><a href="#local-6989586621679078667"><span class="hs-identifier hs-var hs-var">bufferFullH</span></a></span></span><span> </span><span id="local-6989586621679078666"><span class="annot"><span class="annottext">Ptr a
</span><a href="#local-6989586621679078666"><span class="hs-identifier hs-var">endPtr</span></a></span></span><span> </span><span id="local-6989586621679078665"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679078665"><span class="hs-identifier hs-var">minReq</span></a></span></span><span> </span><span id="local-6989586621679078664"><span class="annot"><span class="annottext">BuildStep ()
</span><a href="#local-6989586621679078664"><span class="hs-identifier hs-var">step'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-133"></span><span>            </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679078663"><span class="annot"><span class="annottext">wc :: Int
</span><a href="#local-6989586621679078663"><span class="hs-identifier hs-var hs-var">wc</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Ptr a -&gt; Int
forall a b. Ptr a -&gt; Ptr b -&gt; Int
</span><a href="#local-6989586621679078682"><span class="hs-identifier hs-var">bytesWritten</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679078677"><span class="hs-identifier hs-var">buf</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr a
</span><a href="#local-6989586621679078666"><span class="hs-identifier hs-var">endPtr</span></a></span><span>
</span><span id="line-134"></span><span>                </span><span id="local-6989586621679078662"><span class="annot"><span class="annottext">next :: Next
</span><a href="#local-6989586621679078662"><span class="hs-identifier hs-var hs-var">next</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; BufferWriter -&gt; Next
</span><a href="Data.ByteString.Builder.Extra.html#More"><span class="hs-identifier hs-var">More</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679078665"><span class="hs-identifier hs-var">minReq</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BuildStep () -&gt; BufferWriter
</span><a href="#local-6989586621679078685"><span class="hs-identifier hs-var">run</span></a></span><span> </span><span class="annot"><span class="annottext">BuildStep ()
</span><a href="#local-6989586621679078664"><span class="hs-identifier hs-var">step'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-135"></span><span>             </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">(Int, Next) -&gt; m (Int, Next)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679078663"><span class="hs-identifier hs-var">wc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Next
</span><a href="#local-6989586621679078662"><span class="hs-identifier hs-var">next</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-136"></span><span>
</span><span id="line-137"></span><span>          </span><span id="local-6989586621679078659"><span class="annot"><span class="annottext">insertChunkH :: Ptr a -&gt; ByteString -&gt; BuildStep () -&gt; m (Int, Next)
</span><a href="#local-6989586621679078659"><span class="hs-identifier hs-var hs-var">insertChunkH</span></a></span></span><span> </span><span id="local-6989586621679078658"><span class="annot"><span class="annottext">Ptr a
</span><a href="#local-6989586621679078658"><span class="hs-identifier hs-var">endPtr</span></a></span></span><span> </span><span id="local-6989586621679078657"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679078657"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span id="local-6989586621679078656"><span class="annot"><span class="annottext">BuildStep ()
</span><a href="#local-6989586621679078656"><span class="hs-identifier hs-var">step'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-138"></span><span>            </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679078655"><span class="annot"><span class="annottext">wc :: Int
</span><a href="#local-6989586621679078655"><span class="hs-identifier hs-var hs-var">wc</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Ptr a -&gt; Int
forall a b. Ptr a -&gt; Ptr b -&gt; Int
</span><a href="#local-6989586621679078682"><span class="hs-identifier hs-var">bytesWritten</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679078677"><span class="hs-identifier hs-var">buf</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr a
</span><a href="#local-6989586621679078658"><span class="hs-identifier hs-var">endPtr</span></a></span><span>
</span><span id="line-139"></span><span>                </span><span id="local-6989586621679078654"><span class="annot"><span class="annottext">next :: Next
</span><a href="#local-6989586621679078654"><span class="hs-identifier hs-var hs-var">next</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; BufferWriter -&gt; Next
</span><a href="Data.ByteString.Builder.Extra.html#Chunk"><span class="hs-identifier hs-var">Chunk</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679078657"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BuildStep () -&gt; BufferWriter
</span><a href="#local-6989586621679078685"><span class="hs-identifier hs-var">run</span></a></span><span> </span><span class="annot"><span class="annottext">BuildStep ()
</span><a href="#local-6989586621679078656"><span class="hs-identifier hs-var">step'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-140"></span><span>             </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">(Int, Next) -&gt; m (Int, Next)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679078655"><span class="hs-identifier hs-var">wc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Next
</span><a href="#local-6989586621679078654"><span class="hs-identifier hs-var">next</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-141"></span><span>
</span><span id="line-142"></span><span>          </span><span id="local-6989586621679078653"><span class="annot"><span class="annottext">br :: BufferRange
</span><a href="#local-6989586621679078653"><span class="hs-identifier hs-var hs-var">br</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Ptr Word8 -&gt; BufferRange
</span><a href="Data.ByteString.Builder.Internal.html#BufferRange"><span class="hs-identifier hs-var">I.BufferRange</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679078677"><span class="hs-identifier hs-var">buf</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679078677"><span class="hs-identifier hs-var">buf</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Int -&gt; Ptr Word8
forall a b. Ptr a -&gt; Int -&gt; Ptr b
</span><a href="../../base/src/GHC.Ptr.html#plusPtr"><span class="hs-operator hs-var">`plusPtr`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679078676"><span class="hs-identifier hs-var">len</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-143"></span><span>
</span><span id="line-144"></span><span>      </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">BuildStep ()
-&gt; (Ptr Word8 -&gt; () -&gt; IO (Int, Next))
-&gt; (Ptr Word8 -&gt; Int -&gt; BuildStep () -&gt; IO (Int, Next))
-&gt; (Ptr Word8 -&gt; ByteString -&gt; BuildStep () -&gt; IO (Int, Next))
-&gt; BufferRange
-&gt; IO (Int, Next)
forall a b.
BuildStep a
-&gt; (Ptr Word8 -&gt; a -&gt; IO b)
-&gt; (Ptr Word8 -&gt; Int -&gt; BuildStep a -&gt; IO b)
-&gt; (Ptr Word8 -&gt; ByteString -&gt; BuildStep a -&gt; IO b)
-&gt; BufferRange
-&gt; IO b
</span><a href="Data.ByteString.Builder.Internal.html#fillWithBuildStep"><span class="hs-identifier hs-var">I.fillWithBuildStep</span></a></span><span> </span><span class="annot"><span class="annottext">BuildStep ()
</span><a href="#local-6989586621679078678"><span class="hs-identifier hs-var">step</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; () -&gt; IO (Int, Next)
forall {m :: * -&gt; *} {a}. Monad m =&gt; Ptr a -&gt; () -&gt; m (Int, Next)
</span><a href="#local-6989586621679078673"><span class="hs-identifier hs-var">doneH</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Int -&gt; BuildStep () -&gt; IO (Int, Next)
forall {m :: * -&gt; *} {a}.
Monad m =&gt;
Ptr a -&gt; Int -&gt; BuildStep () -&gt; m (Int, Next)
</span><a href="#local-6989586621679078667"><span class="hs-identifier hs-var">bufferFullH</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; ByteString -&gt; BuildStep () -&gt; IO (Int, Next)
forall {m :: * -&gt; *} {a}.
Monad m =&gt;
Ptr a -&gt; ByteString -&gt; BuildStep () -&gt; m (Int, Next)
</span><a href="#local-6989586621679078659"><span class="hs-identifier hs-var">insertChunkH</span></a></span><span> </span><span class="annot"><span class="annottext">BufferRange
</span><a href="#local-6989586621679078653"><span class="hs-identifier hs-var">br</span></a></span><span>
</span><span id="line-145"></span><span>
</span><span id="line-146"></span><span>
</span><span id="line-147"></span><span>
</span><span id="line-148"></span><span class="hs-comment">------------------------------------------------------------------------------</span><span>
</span><span id="line-149"></span><span class="hs-comment">-- Host-specific encodings</span><span>
</span><span id="line-150"></span><span class="hs-comment">------------------------------------------------------------------------------</span><span>
</span><span id="line-151"></span><span>
</span><span id="line-152"></span><span class="hs-comment">-- | Encode a single native machine 'Int'. The 'Int' is encoded in host order,</span><span>
</span><span id="line-153"></span><span class="hs-comment">-- host endian form, for the machine you're on. On a 64 bit machine the 'Int'</span><span>
</span><span id="line-154"></span><span class="hs-comment">-- is an 8 byte value, on a 32 bit machine, 4 bytes. Values encoded this way</span><span>
</span><span id="line-155"></span><span class="hs-comment">-- are not portable to different endian or int sized machines, without</span><span>
</span><span id="line-156"></span><span class="hs-comment">-- conversion.</span><span>
</span><span id="line-157"></span><span class="hs-comment">--</span><span>
</span><span id="line-158"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#intHost"><span class="hs-pragma hs-type">intHost</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-159"></span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#intHost"><span class="hs-identifier hs-type">intHost</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-160"></span><span id="intHost"><span class="annot"><span class="annottext">intHost :: Int -&gt; Builder
</span><a href="Data.ByteString.Builder.Extra.html#intHost"><span class="hs-identifier hs-var hs-var">intHost</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Int -&gt; Int -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Int
</span><a href="Data.ByteString.Builder.Prim.Binary.html#intHost"><span class="hs-identifier hs-var">P.intHost</span></a></span><span>
</span><span id="line-161"></span><span>
</span><span id="line-162"></span><span class="hs-comment">-- | Encode a 'Int16' in native host order and host endianness.</span><span>
</span><span id="line-163"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#int16Host"><span class="hs-pragma hs-type">int16Host</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-164"></span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#int16Host"><span class="hs-identifier hs-type">int16Host</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int16"><span class="hs-identifier hs-type">Int16</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-165"></span><span id="int16Host"><span class="annot"><span class="annottext">int16Host :: Int16 -&gt; Builder
</span><a href="Data.ByteString.Builder.Extra.html#int16Host"><span class="hs-identifier hs-var hs-var">int16Host</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Int16 -&gt; Int16 -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Int16
</span><a href="Data.ByteString.Builder.Prim.Binary.html#int16Host"><span class="hs-identifier hs-var">P.int16Host</span></a></span><span>
</span><span id="line-166"></span><span>
</span><span id="line-167"></span><span class="hs-comment">-- | Encode a 'Int32' in native host order and host endianness.</span><span>
</span><span id="line-168"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#int32Host"><span class="hs-pragma hs-type">int32Host</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-169"></span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#int32Host"><span class="hs-identifier hs-type">int32Host</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-identifier hs-type">Int32</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-170"></span><span id="int32Host"><span class="annot"><span class="annottext">int32Host :: Int32 -&gt; Builder
</span><a href="Data.ByteString.Builder.Extra.html#int32Host"><span class="hs-identifier hs-var hs-var">int32Host</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Int32 -&gt; Int32 -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Int32
</span><a href="Data.ByteString.Builder.Prim.Binary.html#int32Host"><span class="hs-identifier hs-var">P.int32Host</span></a></span><span>
</span><span id="line-171"></span><span>
</span><span id="line-172"></span><span class="hs-comment">-- | Encode a 'Int64' in native host order and host endianness.</span><span>
</span><span id="line-173"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#int64Host"><span class="hs-pragma hs-type">int64Host</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-174"></span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#int64Host"><span class="hs-identifier hs-type">int64Host</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-175"></span><span id="int64Host"><span class="annot"><span class="annottext">int64Host :: Int64 -&gt; Builder
</span><a href="Data.ByteString.Builder.Extra.html#int64Host"><span class="hs-identifier hs-var hs-var">int64Host</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Int64 -&gt; Int64 -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Int64
</span><a href="Data.ByteString.Builder.Prim.Binary.html#int64Host"><span class="hs-identifier hs-var">P.int64Host</span></a></span><span>
</span><span id="line-176"></span><span>
</span><span id="line-177"></span><span class="hs-comment">-- | Encode a single native machine 'Word'. The 'Word' is encoded in host order,</span><span>
</span><span id="line-178"></span><span class="hs-comment">-- host endian form, for the machine you're on. On a 64 bit machine the 'Word'</span><span>
</span><span id="line-179"></span><span class="hs-comment">-- is an 8 byte value, on a 32 bit machine, 4 bytes. Values encoded this way</span><span>
</span><span id="line-180"></span><span class="hs-comment">-- are not portable to different endian or word sized machines, without</span><span>
</span><span id="line-181"></span><span class="hs-comment">-- conversion.</span><span>
</span><span id="line-182"></span><span class="hs-comment">--</span><span>
</span><span id="line-183"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#wordHost"><span class="hs-pragma hs-type">wordHost</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-184"></span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#wordHost"><span class="hs-identifier hs-type">wordHost</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Word"><span class="hs-identifier hs-type">Word</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-185"></span><span id="wordHost"><span class="annot"><span class="annottext">wordHost :: Word -&gt; Builder
</span><a href="Data.ByteString.Builder.Extra.html#wordHost"><span class="hs-identifier hs-var hs-var">wordHost</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Word -&gt; Word -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Word
</span><a href="Data.ByteString.Builder.Prim.Binary.html#wordHost"><span class="hs-identifier hs-var">P.wordHost</span></a></span><span>
</span><span id="line-186"></span><span>
</span><span id="line-187"></span><span class="hs-comment">-- | Encode a 'Word16' in native host order and host endianness.</span><span>
</span><span id="line-188"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#word16Host"><span class="hs-pragma hs-type">word16Host</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-189"></span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#word16Host"><span class="hs-identifier hs-type">word16Host</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word16"><span class="hs-identifier hs-type">Word16</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-190"></span><span id="word16Host"><span class="annot"><span class="annottext">word16Host :: Word16 -&gt; Builder
</span><a href="Data.ByteString.Builder.Extra.html#word16Host"><span class="hs-identifier hs-var hs-var">word16Host</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Word16 -&gt; Word16 -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Word16
</span><a href="Data.ByteString.Builder.Prim.Binary.html#word16Host"><span class="hs-identifier hs-var">P.word16Host</span></a></span><span>
</span><span id="line-191"></span><span>
</span><span id="line-192"></span><span class="hs-comment">-- | Encode a 'Word32' in native host order and host endianness.</span><span>
</span><span id="line-193"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#word32Host"><span class="hs-pragma hs-type">word32Host</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-194"></span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#word32Host"><span class="hs-identifier hs-type">word32Host</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-identifier hs-type">Word32</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-195"></span><span id="word32Host"><span class="annot"><span class="annottext">word32Host :: Word32 -&gt; Builder
</span><a href="Data.ByteString.Builder.Extra.html#word32Host"><span class="hs-identifier hs-var hs-var">word32Host</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Word32 -&gt; Word32 -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Word32
</span><a href="Data.ByteString.Builder.Prim.Binary.html#word32Host"><span class="hs-identifier hs-var">P.word32Host</span></a></span><span>
</span><span id="line-196"></span><span>
</span><span id="line-197"></span><span class="hs-comment">-- | Encode a 'Word64' in native host order and host endianness.</span><span>
</span><span id="line-198"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#word64Host"><span class="hs-pragma hs-type">word64Host</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-199"></span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#word64Host"><span class="hs-identifier hs-type">word64Host</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word64"><span class="hs-identifier hs-type">Word64</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-200"></span><span id="word64Host"><span class="annot"><span class="annottext">word64Host :: Word64 -&gt; Builder
</span><a href="Data.ByteString.Builder.Extra.html#word64Host"><span class="hs-identifier hs-var hs-var">word64Host</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Word64 -&gt; Word64 -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Word64
</span><a href="Data.ByteString.Builder.Prim.Binary.html#word64Host"><span class="hs-identifier hs-var">P.word64Host</span></a></span><span>
</span><span id="line-201"></span><span>
</span><span id="line-202"></span><span class="hs-comment">-- | Encode a 'Float' in native host order. Values encoded this way are not</span><span>
</span><span id="line-203"></span><span class="hs-comment">-- portable to different endian machines, without conversion.</span><span>
</span><span id="line-204"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#floatHost"><span class="hs-pragma hs-type">floatHost</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-205"></span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#floatHost"><span class="hs-identifier hs-type">floatHost</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Float"><span class="hs-identifier hs-type">Float</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-206"></span><span id="floatHost"><span class="annot"><span class="annottext">floatHost :: Float -&gt; Builder
</span><a href="Data.ByteString.Builder.Extra.html#floatHost"><span class="hs-identifier hs-var hs-var">floatHost</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Float -&gt; Float -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Float
</span><a href="Data.ByteString.Builder.Prim.Binary.html#floatHost"><span class="hs-identifier hs-var">P.floatHost</span></a></span><span>
</span><span id="line-207"></span><span>
</span><span id="line-208"></span><span class="hs-comment">-- | Encode a 'Double' in native host order.</span><span>
</span><span id="line-209"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#doubleHost"><span class="hs-pragma hs-type">doubleHost</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-210"></span><span class="annot"><a href="Data.ByteString.Builder.Extra.html#doubleHost"><span class="hs-identifier hs-type">doubleHost</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Double"><span class="hs-identifier hs-type">Double</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-211"></span><span id="doubleHost"><span class="annot"><span class="annottext">doubleHost :: Double -&gt; Builder
</span><a href="Data.ByteString.Builder.Extra.html#doubleHost"><span class="hs-identifier hs-var hs-var">doubleHost</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Double -&gt; Double -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Double
</span><a href="Data.ByteString.Builder.Prim.Binary.html#doubleHost"><span class="hs-identifier hs-var">P.doubleHost</span></a></span><span>
</span><span id="line-212"></span><span>
</span><span id="line-213"></span></pre></body></html>